package com.zygh.lz.controller;

import com.zygh.lz.entity.Sptype;
import com.zygh.lz.entity.Xarea;
import com.zygh.lz.service.IndexService;
import com.zygh.lz.stapprove.ResultUtil;
import com.zygh.lz.vo.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * @author wxh
 */
@RequestMapping("/index")
@RestController
@Api(tags = "警力部署")
public class IndexController {
    @Resource
    private IndexService indexService;

    @GetMapping("/station")
    @ApiOperation("警力部署下拉框")
    public ResultBean station(HttpServletRequest request){
        List<Map<String, Object>> station = indexService.station(request);
        return ResultUtil.setOK("查询成功",station);
    }

    @GetMapping("/detail")
    @ApiOperation("点击下拉框下详情")
    public ResultBean detail(Xarea xarea){
        Map<String, Object> detail = indexService.detail(xarea);
        return ResultUtil.setOK("查询成功",detail);
    }

    @GetMapping("/battalion")
    @ApiOperation("警力部署下拉框")
    public ResultBean battion(HttpServletRequest request){
        List<Map<String, Object>> battalion = indexService.battalion(request);
        return ResultUtil.setOK("查询成功",battalion);
    }

    @GetMapping("/sptype")
    @ApiOperation("特殊勤务下拉框")
    public ResultBean sptype(HttpServletRequest request){
        List<Map> sytype = indexService.sptype(request);
        return ResultUtil.setOK("查询成功",sytype);
    }
    @GetMapping("/sptype/detail")
    @ApiOperation("特殊勤务详情")
    public ResultBean sptypeDetail(Sptype sptype){
       return indexService.sptypeDetail(sptype);
    }
}
